import { useEffect, useState } from "react";
import { Image, StyleSheet, Text, View } from "react-native";
import * as Tabs from "react-native-collapsible-tab-view";
import apiService from "../services/ApiServices";
import ProfilePipeItemView from "./ProfilePipeItemView.android";

type ProfilePipeListViewProps = {
  uid: string;
};
const ProfilePipeListView = ({ uid }: ProfilePipeListViewProps) => {
  const [dataList, setDataList] = useState([]);

  const fetchData = async () => {
    const result = await apiService.getUserPipeList(uid);
    setDataList(result?.data.list);
  };

  useEffect(() => {
    fetchData();
  }, []);

  const renderItem = (item: any) => {
    return <ProfilePipeItemView data={item}/>;
  };
  return (
    <Tabs.FlatList
      data={dataList}
      numColumns={2}
      renderItem={renderItem}
    />
  );
};

export default ProfilePipeListView;
